<?php

namespace app\common\command\modelcreater;

use think\facade\Log;

class Base
{
    public static $debug = true;
    public static $isLog = true;

    public static function writeln($obj, $format = "string")
    {
        $str = "";
        if ($format == "string") {
            $str = print_r($obj, true) . "\n";
        }
        if ($format == "json") {
            $str = json_encode($obj, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . "\n";
        }
        if (self::$debug) {
            echo $str;
        }
        if (self::$isLog) {
            Log::record($str, 'debug');
        }
    }

}